<template>
	<view class="wrap">
		<view class="usable-amount">可用金额：29，999.00</view>
    <view class="withdraw-content">
      <text>提现金额:</text>
      <input type="digit" value="" placeholder="最低提现10元" placeholder-class="placeholder"/>
    </view>
    <button type="primary" @click="withdraw">提现</button>
	</view>
</template>

<script>
  import {User} from '@/apis'
  import {utils, numeral} from '@/utils'
  
	export default {
		data() {
			return {
				
			};
		},
    methods: {
      withdraw () {
        const userInfo = uni.getStorageSync('userInfo')
        const outTradeNo = utils.randomWord(false, 32)
        
        User.withdraw({
          data: {
            form: {
              device_info: "1",
              body: "shangpinmiaoshu",
              detail: "shangpinxiangqing",
              out_trade_no: outTradeNo,
              orderNumber: Date.now(),
              paymentFee: numeral(1).multiply(100).value(),
              spbill_create_ip: "0.0.0.0",
              time_start: Date.now(),
              notify_url: "http://www.weixin.qq.com/wxpay/pay.php",
              product_id: utils.randomWord(false, 16),
              openid: userInfo.openid
            },
            query: {},
            pagination: {}
          }
        }).then(res => {
          console.log('提现成功 ==>', res)
        }).catch(err => {
          console.log(err)
        })
      }
    }
	}
</script>

<style lang="scss">
.usable-amount{
  box-sizing: border-box;
  padding-top: 138rpx;
  font-size: 40rpx;
  padding-left: 66rpx;
  padding-bottom: 40rpx;
}
.withdraw-content {
  display: flex;
  padding: 0 60rpx;
  box-sizing: border-box;
  align-items: center;
  text {
    font-size: 28rpx;
    padding-right: 28rpx;
  }
  input {
    height: 100rpx;
    line-height: 100rpx;
    font-size: 28rpx;
    
  }
}
.placeholder {
  color: #999999;
}
button {
  width: 690rpx;
  margin: 0 auto;
  margin-top: 200rpx;
}
</style>
